#include <common/macro/build.h>

/**
 * Verifies that the given arity is within permissible
 * range.
 *
 * @param minarity Minimum arity.
 * @param maxarity Maximum arity, or -1 for unlimited.
 * @param argc Argument count that is to be verified.
 * @return True (1) if matches, false (0) otherwise.
 */
API_LIBLOCAL int arity_check(int minarity, int maxarity, int argc) {
	if (argc < minarity)
		return 0;
	
	if (maxarity != -1)
		return (argc <= maxarity);

	return 1;
}
